import request from '@/utils/request'

// 获取用户信息
export function getUserInfo() {
  return request({
    url: '/auth/userinfo',
    method: 'get'
  })
}

// 更新用户信息
export function updateUserInfo(data) {
  return request({
    url: '/auth/update',
    method: 'put',
    data
  })
}

// 修改密码
export function changePassword(data) {
  return request({
    url: '/auth/change-password',
    method: 'put',
    data
  })
}

// 获取用户收藏
export function getUserCollections(params) {
  return request({
    url: '/user/collections',
    method: 'get',
    params
  })
}

// 获取用户维权进度
export function getUserProgress(params) {
  return request({
    url: '/user/progress',
    method: 'get',
    params
  })
}

// 上传头像
export function uploadAvatar(data) {
  return request({
    url: '/file/upload/avatar',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}